/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Pablo
 */
@Entity
@Table(name = "idiomas")
@NamedQueries({
    @NamedQuery(name = "Idioma.findAll", query = "SELECT i FROM Idioma i")})
public class Idioma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_idioma")
    private Integer idIdioma;
    @Size(max = 25)
    @Column(name = "idioma")
    private String idioma;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idIdioma", fetch = FetchType.EAGER)
    private List<Idiomasusuario> idiomasusuarioList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idIdioma", fetch = FetchType.EAGER)
    private List<Idiomastrad> idiomastradList;

    public Idioma() {
    }

    public Idioma(Integer idIdioma) {
        this.idIdioma = idIdioma;
    }

    public Integer getIdIdioma() {
        return idIdioma;
    }

    public void setIdIdioma(Integer idIdioma) {
        this.idIdioma = idIdioma;
    }

    public String getIdioma() {
        return idioma;
    }

    public void setIdioma(String idioma) {
        this.idioma = idioma;
    }

    public List<Idiomasusuario> getIdiomasusuarioList() {
        return idiomasusuarioList;
    }

    public void setIdiomasusuarioList(List<Idiomasusuario> idiomasusuarioList) {
        this.idiomasusuarioList = idiomasusuarioList;
    }

    public List<Idiomastrad> getIdiomastradList() {
        return idiomastradList;
    }

    public void setIdiomastradList(List<Idiomastrad> idiomastradList) {
        this.idiomastradList = idiomastradList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idIdioma != null ? idIdioma.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Idioma)) {
            return false;
        }
        Idioma other = (Idioma) object;
        if ((this.idIdioma == null && other.idIdioma != null) || (this.idIdioma != null && !this.idIdioma.equals(other.idIdioma))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Idioma[ idIdioma=" + idIdioma + " ]";
    }
    
}
